/**
 * 双指针
 * @param {number[]} nums
 * @return {number}
 */
var removeDuplicates = function (nums) {
    let l = nums.length
    if (l <= 1) return l

    let slow = 1, fast = 1

    while (fast < l) {
        if (nums[fast] !== nums[fast - 1]) {
            nums[slow] = nums[fast]
            slow++
        }
        fast++
    }
    return slow
};